﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
    // Token: 0x02000FBD RID: 4029
    internal sealed class XBillboardComponent : XComponent
    {
        // Token: 0x170036A6 RID: 13990
        // (get) Token: 0x0600D147 RID: 53575 RVA: 0x00306F6C File Offset: 0x0030516C
        public override uint ID
        {
            get
            {
                return XBillboardComponent.uuID;
            }
        }

        // Token: 0x0600D148 RID: 53576 RVA: 0x00306F84 File Offset: 0x00305184
        public XBillboardComponent()
        {
            this._resetOnHitCb = new XTimerMgr.ElapsedEventHandler(this.ResetOnHit);
        }

        // Token: 0x0600D149 RID: 53577 RVA: 0x00307090 File Offset: 0x00305290
        public override void OnAttachToHost(XObject host)
        {
            base.OnAttachToHost(host);
            GameObject billboard = XBillBoardDocument.GetBillboard(this._entity.EngineObject.Position, this._entity.EngineObject.Rotation);
            if (billboard != null)
            {
                billboard.name = this._entity.ID.ToString() + "_billb";
                this._billboard = billboard.transform;
            }
            this._uiDummy = (this._billboard.GetComponent("UIDummy") as IUIDummy);
            if (this._entity.IsNpc)
            {
                IUIRect parent = XSingleton<XGameUI>.singleton.NpcHpbarRoot.UIComponent as IUIRect;
                XSingleton<UiUtility>.singleton.AddChild(parent, billboard, XSingleton<XGameUI>.singleton.NpcHpbarRoot);
            }
            else
            {
                IUIRect parent2 = XSingleton<XGameUI>.singleton.HpbarRoot.UIComponent as IUIRect;
                XSingleton<UiUtility>.singleton.AddChild(parent2, billboard, XSingleton<XGameUI>.singleton.HpbarRoot);
            }
            if (XBillboardComponent.fscale == null)
            {
                XSingleton<XGlobalConfig>.singleton.GetFloatList("BillboardScaleConfig", ref XBillboardComponent.fscale);
            }
        }

        // Token: 0x0600D14A RID: 53578 RVA: 0x003071BC File Offset: 0x003053BC
        protected override void EventSubscribe()
        {
            base.RegisterEvent(XEventDefine.XEvent_HUDAdd, new XComponent.XEventHandler(this.OnHit));
            base.RegisterEvent(XEventDefine.XEvent_GuildInfoChange, new XComponent.XEventHandler(this.OnGuildInfoChange));
            base.RegisterEvent(XEventDefine.XEvent_DesignationInfoChange, new XComponent.XEventHandler(this.OnDesignationInfoChange));
            base.RegisterEvent(XEventDefine.XEvent_TitleChange, new XComponent.XEventHandler(this.OnTitleNameChange));
            base.RegisterEvent(XEventDefine.XEvent_BillboardHide, new XComponent.XEventHandler(this.OnHideSelf));
            base.RegisterEvent(XEventDefine.XEvent_BillboardShowCtrl, new XComponent.XEventHandler(this.OnShowCtrl));
            base.RegisterEvent(XEventDefine.XEvent_FightGroupChanged, new XComponent.XEventHandler(this.OnFightGroupChange));
            base.RegisterEvent(XEventDefine.XEvent_BigMeleePointChange, new XComponent.XEventHandler(this.OnBigMeleePointChange));
            base.RegisterEvent(XEventDefine.XEvent_BigMeleeEnemyChange, new XComponent.XEventHandler(this.OnBigMeleeEnemyChange));
        }

        // Token: 0x0600D14B RID: 53579 RVA: 0x00307298 File Offset: 0x00305498
        private bool OnHit(XEventArgs e)
        {
            this._bHitFlag = true;
            if (this._timer > 0U)
            {
                XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
            }
            this._timer = XSingleton<XTimerMgr>.singleton.SetTimer(2f, this._resetOnHitCb, null);
            return true;
        }

        // Token: 0x0600D14C RID: 53580 RVA: 0x003072EC File Offset: 0x003054EC
        private void ResetOnHit(object o)
        {
            this._bHitFlag = false;
        }

        // Token: 0x0600D14D RID: 53581 RVA: 0x003072F8 File Offset: 0x003054F8
        private bool OnFightGroupChange(XEventArgs e)
        {
            this.Refresh();
            return true;
        }

        // Token: 0x0600D14E RID: 53582 RVA: 0x00307312 File Offset: 0x00305512
        public void Refresh()
        {
            this.Attached();
        }

        // Token: 0x170036A7 RID: 13991
        // (get) Token: 0x0600D14F RID: 53583 RVA: 0x0030731C File Offset: 0x0030551C
        public float viewDistance
        {
            get
            {
                return this._viewDistance;
            }
        }

        // Token: 0x170036A8 RID: 13992
        // (get) Token: 0x0600D150 RID: 53584 RVA: 0x00307334 File Offset: 0x00305534
        public bool alwaysShow
        {
            get
            {
                return this._alwaysShow;
            }
        }

        // Token: 0x0600D151 RID: 53585 RVA: 0x0030734C File Offset: 0x0030554C
        public override void Attached()
        {
            base.Attached();
            this._inited = true;
            this._compRef = (this._billboard.GetComponent("XUIBillBoardCompRef") as IXUIBillBoardCompRef);
            this._bloodBar = this._compRef.BloodBar;
            this._indureBar = this._compRef.IndureBar;
            this._desiSpcSymbol = this._compRef.DesiSpecLabelSymbol;
            this._guildSpcSymbol = this._compRef.GuildSpecLabelSymbol;
            this._nameSpcSymbol = this._compRef.NameSpecLabelSymbol;
            this._active = this._billboard.gameObject.activeInHierarchy;
            if (this._active)
            {
                this._desiSpcSymbol.SetVisible(false);
                this.UpdateDesignationPos();
                XEntityStatistics.RowData byID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
                this._alwaysShow = (!this._entity.IsRole && byID != null && byID.AlwaysHpBar);
                if (XSingleton<XSceneMgr>.singleton.IsPVEScene())
                {
                    if (XSingleton<XScene>.singleton.bSpectator)
                    {
                        if (XSingleton<XEntityMgr>.singleton.Player == null || XSingleton<XEntityMgr>.singleton.Player.WatchTo == null)
                        {
                            this._inited = false;
                            return;
                        }
                    }
                    bool flag4 = XSingleton<XScene>.singleton.bSpectator ? XSingleton<XEntityMgr>.singleton.IsOpponent(XSingleton<XEntityMgr>.singleton.Player.WatchTo, this._entity) : XSingleton<XEntityMgr>.singleton.IsOpponent(XSingleton<XEntityMgr>.singleton.Player, this._entity);
                    this._viewDistance = XSingleton<XProfessionSkillMgr>.singleton.GetVisibleDistance(0U);
                    if (this._entity.IsPlayer)
                    {
                        this.SetupInfo(false, false, this._alwaysShow, false, "", XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
                        this.f = XBillboardComponent.fscale[0];
                    }
                    else
                    {
                        if (flag4)
                        {
                            if (this._entity.IsBoss)
                            {
                                this._viewDistance = 30f;
                                this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_red, XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
                                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                                {
                                    this.GetStr(XBillboardComponent.BOSS_ICON_ATLAS, XBillboardComponent.BOSS_ICON_SPRITE, false),
                                    this.GetStr("", this._nameColor + this._entity.Attributes.Name, false),
                                    this.GetStr(XBillboardComponent.BOSS_ICON_ATLAS, XBillboardComponent.BOSS_ICON_SPRITE, false)
                                });
                                this.f = XBillboardComponent.fscale[1];
                            }
                            else
                            {
                                if (this._entity.IsElite)
                                {
                                    this.SetupInfo(true, false, true, true, XBillboardComponent.billboardString_gold, XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.billboard_yellow);
                                    XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                                    {
                                        this.GetStr(XBillboardComponent.ELITE_ICON_ATLAS, XBillboardComponent.ELITE_ICON_SPRITE, false),
                                        this.GetStr("", this._nameColor + this._entity.Attributes.Name, false),
                                        this.GetStr(XBillboardComponent.ELITE_ICON_ATLAS, XBillboardComponent.ELITE_ICON_SPRITE, false)
                                    });
                                    this._alwaysShow = true;
                                    this._bHpbarVisible = true;
                                    this._bIndurebarVisible = true;
                                    this._secondbar_usage = BillboardUsage.Indure;
                                    this.f = XBillboardComponent.fscale[2];
                                }
                                else
                                {
                                    if (this._entity.IsOpposer)
                                    {
                                        if (this._entity.Prefab == "Empty_monster_trap")
                                        {
                                            this.SetupInfo(false, false, false, false, "", XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
                                            this._bHpbarVisible = false;
                                        }
                                        else
                                        {
                                            this.SetupInfo(false, false, true, false, "", XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
                                            this._bHpbarVisible = true;
                                        }
                                        this.f = XBillboardComponent.fscale[3];
                                    }
                                    else
                                    {
                                        if (this._entity.IsRole)
                                        {
                                            this.SetupInfo(true, true, true, false, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
                                            this._alwaysShow = true;
                                            this._bHpbarVisible = true;
                                            this._bIndurebarVisible = false;
                                            this.SetupGuildInfo();
                                            this.f = XBillboardComponent.fscale[4];
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            this._viewDistance = 10f;
                            if (!this._entity.IsPuppet && !this._entity.IsSubstance)
                            {
                                XEntityStatistics.RowData byID2 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
                                if (!this._entity.IsRole && byID2 != null)
                                {
                                    this.SetupInfo(!byID2.HideName, false, this._alwaysShow, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_ally_hp, XBillboardComponent.nullColor);
                                }
                                else
                                {
                                    this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_ally_hp, XBillboardComponent.nullColor);
                                }
                                this._bHpbarVisible = this._alwaysShow;
                                this.SetupGuildInfo();
                                if (this._entity.IsRole)
                                {
                                    this.f = XBillboardComponent.fscale[4];
                                }
                                else
                                {
                                    this.f = XBillboardComponent.fscale[6];
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (XSingleton<XSceneMgr>.singleton.IsPVPScene())
                    {
                        this._viewDistance = 10f;
                        this._bHpbarVisible = true;
                        this._bIndurebarVisible = true;
                        if (this._entity.IsPlayer)
                        {
                            this.f = XBillboardComponent.fscale[0];
                        }
                        else
                        {
                            this.f = XBillboardComponent.fscale[4];
                        }
                        if ((this._entity.IsRole || (this._entity.Attributes != null && this._entity.Attributes.HostID != 0UL)) && XSingleton<XScene>.singleton.bSpectator)
                        {
                            if (this._entity.IsPlayer)
                            {
                                this._bHpbarVisible = false;
                                this._bIndurebarVisible = false;
                                this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
                            }
                            else
                            {
                                if (this._entity.IsRole)
                                {
                                    //zcg 
//                                     XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
//                                     bool flag12;
//                                     if (!specificDocument.TryGetEntityIsBlueTeam(this._entity, out flag12))
                                    {
                                        this._bHpbarVisible = false;
                                        this._bIndurebarVisible = false;
                                        this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
                                    }
                                    //zcg 
//                                     else
//                                     {
//                                         if (flag12)
//                                         {
//                                             this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
//                                         }
//                                         else
//                                         {
//                                             this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_green, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue);
//                                         }
//                                         this._alwaysShow = true;
//                                         this._secondbar_usage = BillboardUsage.MP;
//                                         this.SetupGuildInfo();
//                                     }
                                    XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
                                    this.DealWithTitleNameChange(0U, xroleAttributes.MilitaryRank);
                                }
                                else
                                {
                                    if (this._entity.Attributes != null && this._entity.Attributes.HostID > 0UL)
                                    {
                                        //zcg 
//                                         XSpectateSceneDocument specificDocument2 = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
//                                         bool flag16;
//                                         if (!specificDocument2.TryGetSummonedIsBlueTeam(this._entity, out flag16))
                                        {
                                            this._bHpbarVisible = false;
                                            this._bIndurebarVisible = false;
                                            this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
                                        }
                                        //zcg 
//                                         else
//                                         {
//                                             string nameColor = flag16 ? XBillboardComponent.billboardString_blue : XBillboardComponent.billboardString_red;
//                                             Color bloodColor = flag16 ? XBillboardComponent.billboard_green : XBillboardComponent.billboard_red;
//                                             this._bIndurebarVisible = false;
//                                             XEntityStatistics.RowData byID3 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
//                                             this.SetupInfo(byID3 == null || !byID3.HideName, false, true, false, nameColor, XBillboardComponent.billboard_green, bloodColor, XBillboardComponent.billboard_blue);
//                                             this._bHpbarVisible = this._alwaysShow;
//                                             this._secondbar_usage = BillboardUsage.MP;
//                                         }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!this._entity.IsPlayer && XSingleton<XEntityMgr>.singleton.IsOpponent(XSingleton<XEntityMgr>.singleton.Player, this._entity))
                            {
                                if (!this._entity.IsRole)
                                {
                                    this._bIndurebarVisible = false;
                                    XEntityStatistics.RowData byID4 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
                                    if (byID4 != null)
                                    {
                                        this.SetupInfo(!byID4.HideName, false, true, false, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.nullColor);
                                    }
                                    else
                                    {
                                        this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue);
                                    }
                                    this.SetupGuildInfo();
                                    this._bHpbarVisible = this._alwaysShow;
                                }
                                else
                                {
                                    this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue);
                                    this.SetupGuildInfo();
                                    XRoleAttributes xroleAttributes2 = this._entity.Attributes as XRoleAttributes;
                                    this.DealWithTitleNameChange(0U, xroleAttributes2.MilitaryRank);
                                }
                                this._secondbar_usage = BillboardUsage.MP;
                            }
                            else
                            {
                                if (!this._entity.IsPlayer && !this._entity.IsRole)
                                {
                                    this._bIndurebarVisible = false;
                                    XEntityStatistics.RowData byID5 = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._entity.TypeID);
                                    if (byID5 != null)
                                    {
                                        this.SetupInfo(!byID5.HideName, false, true, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.nullColor);
                                    }
                                    else
                                    {
                                        this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
                                    }
                                    this.SetupGuildInfo();
                                    this._bHpbarVisible = this._alwaysShow;
                                }
                                else
                                {
                                    if (XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT)
                                    {
                                        this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_white, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
                                    }
                                    else
                                    {
                                        this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue);
                                    }
                                    this.SetupGuildInfo();
                                    if (this._entity.IsPlayer)
                                    {
                                        this.DealWithTitleNameChange(XSingleton<XAttributeMgr>.singleton.XPlayerData.TitleID, XSingleton<XAttributeMgr>.singleton.XPlayerData.MilitaryRank);
                                    }
                                    else
                                    {
                                        XRoleAttributes xroleAttributes3 = this._entity.Attributes as XRoleAttributes;
                                        this.DealWithTitleNameChange(0U, xroleAttributes3.MilitaryRank);
                                    }
                                }
                                this._secondbar_usage = BillboardUsage.MP;
                            }
                        }
                    }
                    else
                    {
                        if (this._entity.IsPlayer)
                        {
                            this.SetupInfo(true, true, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_sgreen, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
                            this.SetupGuildInfo();
                            //zcg XDesignationDocument specificDocument3 = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
                            //zcg this.DealWithDesignation(specificDocument3.CoverDesignationID, specificDocument3.SpecialDesignation);
                            this.DealWithTitleNameChange(XSingleton<XAttributeMgr>.singleton.XPlayerData.TitleID, XSingleton<XAttributeMgr>.singleton.XPlayerData.MilitaryRank);
                            this.f = XBillboardComponent.fscale[0];
                        }
                        else
                        {
                            if (XSingleton<XEntityMgr>.singleton.IsAlly(this._entity))
                            {
                                this._viewDistance = Mathf.Sqrt(XQualitySetting._FadeDistance);
                                if (this._entity.IsRole)
                                {
                                    this.SetupInfo(true, true, false, false, XBillboardComponent.billboardString_white, XBillboardComponent.billboard_sgreen, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
                                    this.SetupGuildInfo();
                                    XRoleAttributes xroleAttributes4 = this._entity.Attributes as XRoleAttributes;
                                    this.DealWithDesignation(xroleAttributes4.DesignationID, xroleAttributes4.SpecialDesignation);
                                    this.DealWithTitleNameChange(this._entity.Attributes.TitleID, xroleAttributes4.MilitaryRank);
                                    this.f = XBillboardComponent.fscale[4];
                                }
                                else
                                {
                                    this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_white, XBillboardComponent.billboard_white, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
                                    this.f = XBillboardComponent.fscale[6];
                                }
                            }
                            else
                            {
                                if (this._entity.IsNpc)
                                {
                                    XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(this._entity.TypeID);
                                    if (byNPCID.NPCType == 2U)
                                    {
                                        this._nameSpcSymbol.SetVisible(false);
                                    }
                                    else
                                    {
                                        //zcg 
//                                         XNPCFavorDocument specificDocument4 = XDocuments.GetSpecificDocument<XNPCFavorDocument>(XNPCFavorDocument.uuID);
//                                         if (specificDocument4.IsShowNPCFavoritePlayer(this._entity.TypeID))
//                                         {
//                                             this.SetupInfo(true, true, this._alwaysShow, false, XBillboardComponent.billboardString_syellow, XBillboardComponent.billboard_favor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
//                                             this.SetupNpcFavorInfo();
//                                         }
//                                         else
                                        {
                                            this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_syellow, XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor);
                                        }
                                        this._viewDistance = 10f;
                                        this.f = XBillboardComponent.fscale[5];
                                    }
                                }
                            }
                        }
                    }
                }
                this.DrawStr(this._nameSpcSymbol);
                if (this._entity.IsPlayer)
                {
                    this.SetBillBoardDepth(true, 0f);
                }
                else
                {
                    this.KeepAllDepth();
                }
                this._billboard.transform.localScale = new Vector3(XBillboardComponent.k * this.f, XBillboardComponent.k * this.f, XBillboardComponent.k * this.f);
                this._uiDummy.alpha = 0f;
            }
        }

        // Token: 0x0600D152 RID: 53586 RVA: 0x00308154 File Offset: 0x00306354
        private void SetupNpcFavorInfo()
        {
            if (XSingleton<XSceneMgr>.singleton.IsPVEScene() || XSingleton<XSceneMgr>.singleton.IsPVPScene() || !this._entity.IsNpc)
            {
                this._guildSpcSymbol.SetVisible(false);
            }
            else
            {
                //zcg 
//                 XNPCFavorDocument specificDocument = XDocuments.GetSpecificDocument<XNPCFavorDocument>(XNPCFavorDocument.uuID);
//                 string favoritePlayerName = specificDocument.GetFavoritePlayerName(this._entity.TypeID);
//                 XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
//                 {
//                     this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XBillboardComponent.NPCFAVOR_ICON_SPRITE, false),
//                     this.GetStr("", string.Format("{0}", favoritePlayerName), false)
//                 });
                this.DrawStr(this._guildSpcSymbol);
                XSingleton<UiUtility>.singleton.ComSpriteStr.Clear();
                XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr("", this._nameColor + this._entity.Attributes.Name, false));
            }
        }

        // Token: 0x0600D153 RID: 53587 RVA: 0x00308254 File Offset: 0x00306454
        private void SetBillBoardSameByMaster()
        {
            if (XEntity.ValideEntity(this._entity.MobbedBy))
            {
                XBillboardComponent billBoard = this._entity.MobbedBy.BillBoard;
                this._bHpbarVisible = billBoard._bHpbarVisible;
                this._bIndurebarVisible = billBoard._bIndurebarVisible;
                this._indureBar.SetForegroundColor(XBillboardComponent.billboard_blue);
                this._desiSpcSymbol.Copy(billBoard._desiSpcSymbol);
                this._guildSpcSymbol.Copy(billBoard._guildSpcSymbol);
                this._nameSpcSymbol.Copy(billBoard._nameSpcSymbol);
            }
        }

        // Token: 0x0600D154 RID: 53588 RVA: 0x003082E8 File Offset: 0x003064E8
        private bool OnGuildInfoChange(XEventArgs e)
        {
            this.SetupGuildInfo();
            this.UpdateDesignationPos();
            this.KeepAllDepth();
            return true;
        }

        // Token: 0x0600D155 RID: 53589 RVA: 0x00308310 File Offset: 0x00306510
        private void UpdateDesignationPos()
        {
            if (this._entity.IsPlayer)
            {
                //zcg 
//                 XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
//                 bool flag = !specificDocument.bInGuild;
//                 if (flag)
//                 {
//                     this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 65f, 0f);
//                 }
//                 else
                {
                    this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 96f, 0f);
                }
            }
            else
            {
                if (this._entity.IsRole)
                {
                    XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
                    if (xroleAttributes != null)
                    {
                        if (string.IsNullOrEmpty(xroleAttributes.GuildName) && XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_BIGMELEE_FIGHT)
                        {
                            this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 65f, 0f);
                        }
                        else
                        {
                            this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 96f, 0f);
                        }
                    }
                }
            }
        }

        // Token: 0x170036A9 RID: 13993
        // (get) Token: 0x0600D156 RID: 53590 RVA: 0x0030845C File Offset: 0x0030665C
        private bool isTerritoryFight
        {
            get
            {
                return XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT;
            }
        }

        // Token: 0x0600D157 RID: 53591 RVA: 0x00308490 File Offset: 0x00306690
        public void OnFightDesignationInfoChange(uint id)
        {
            if (this.isTerritoryFight)
            {
                if (this._entity.IsRole)
                {
                    //zcg 
//                     XGuildTerritoryDocument specificDocument = XDocuments.GetSpecificDocument<XGuildTerritoryDocument>(XGuildTerritoryDocument.uuID);
//                     FightDesignation.RowData designation = specificDocument.GetDesignation(id);
//                     this._desiSpcSymbol.SetVisible(id != 0U && designation != null);
//                     bool flag = id != 0U && designation != null;
//                     if (flag)
//                     {
//                         bool flag2 = string.IsNullOrEmpty(designation.Effect);
//                         if (flag2)
//                         {
//                             this._desiSpcSymbol.Board.SetVisible(true);
//                             XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
//                             {
//                                 this.GetStr("", designation.Color + designation.Designation, false)
//                             });
//                             this.DrawStr(this._desiSpcSymbol);
//                         }
//                         else
//                         {
//                             this._desiSpcSymbol.Board.SetVisible(false);
//                             XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
//                             {
//                                 this.GetStr(XBillboardComponent.DESIGNATION_ATLAS, designation.Effect, false)
//                             });
//                             this.DrawStr(this._desiSpcSymbol);
//                         }
//                     }
                }
            }
        }

        // Token: 0x0600D158 RID: 53592 RVA: 0x003085AC File Offset: 0x003067AC
        private void DealWithDesignation(uint id, string specDesi)
        {
            if (!this.isTerritoryFight)
            {
                //zcg
// 				XDesignationDocument specificDocument = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
// 				DesignationTable.RowData byID = specificDocument._DesignationTable.GetByID((int)id);
// 				if (byID == null)
// 				{
// 					id = 0U;
// 				}
// 				this._desiSpcSymbol.SetVisible(id > 0U);
// 				if (id > 0U)
// 				{
// 					if (byID.Effect == "")
// 					{
// 						this._desiSpcSymbol.Board.SetVisible(true);
// 						if (byID.Special)
// 						{
// 							XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
// 							{
// 								 this.GetStr("", byID.Color + specDesi, false)
// 							});
// 						}
// 						else
// 						{
// 							XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
// 							{
// 								 this.GetStr("", byID.Color + byID.Designation, false)
// 							});
// 						}
// 						this.DrawStr(this._desiSpcSymbol);
// 					}
// 					else
// 					{
// 						this._desiSpcSymbol.Board.SetVisible(false);
// 						XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
// 						{
// 							 this.GetStr(byID.Atlas, byID.Effect, false)
// 						});
// 						this.DrawStr(this._desiSpcSymbol);
// 					}
// 				}
			}
        }

        // Token: 0x0600D159 RID: 53593 RVA: 0x003086FC File Offset: 0x003068FC
        public bool OnDesignationInfoChange(XEventArgs e = null)
        {
            bool result;
            if (XSingleton<XSceneMgr>.singleton.IsPVEScene() || XSingleton<XSceneMgr>.singleton.IsPVPScene())
            {
                result = true;
            }
            else
            {
                if (this._entity.IsPlayer)
                {
                    //zcg XDesignationDocument specificDocument = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
                    //zcg this.DealWithDesignation(specificDocument.CoverDesignationID, specificDocument.SpecialDesignation);
                }
                else
                {
                    if (this._entity.IsRole)
                    {
                        XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
                        this.DealWithDesignation(xroleAttributes.DesignationID, xroleAttributes.SpecialDesignation);
                    }
                }
                this.KeepAllDepth();
                result = true;
            }
            return result;
        }

        // Token: 0x0600D15A RID: 53594 RVA: 0x003087A4 File Offset: 0x003069A4
        private void DealWithTitleNameChange(uint titleId, uint level)
        {
            XSingleton<UiUtility>.singleton.ComSpriteStr.Clear();
            if (XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_PVP || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GPR || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT)
            {
                //zcg 
//                 MilitaryRankByExploit.RowData byMilitaryRank = XMilitaryRankDocument._militaryReader.GetByMilitaryRank(level);
//                 bool flag2 = byMilitaryRank != null;
//                 if (flag2)
//                 {
//                     XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr(XBillboardComponent.MILITARY_ATLAS, byMilitaryRank.Icon, false));
//                 }
            }
            if (!XSingleton<XSceneMgr>.singleton.IsPVPScene())
            {
                if (titleId > 0U)
                {
                    //zcg 
//                     TitleTable.RowData title = XTitleDocument.GetTitle(titleId);
//                     bool flag5 = title != null;
//                     if (flag5)
//                     {
//                         XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr(title.RankAtlas, title.RankIcon, true));
//                     }
                }
            }
            XSingleton<UiUtility>.singleton.ComSpriteStr.Add(this.GetStr("", this._nameColor + this._entity.Attributes.Name, false));
        }

        // Token: 0x0600D15B RID: 53595 RVA: 0x003088EC File Offset: 0x00306AEC
        public bool OnTitleNameChange(XEventArgs e = null)
        {
            bool result;
            if (XSingleton<XSceneMgr>.singleton.IsPVEScene())
            {
                result = true;
            }
            else
            {
                if (this._entity.IsPlayer)
                {
                    this.DealWithTitleNameChange(XSingleton<XAttributeMgr>.singleton.XPlayerData.TitleID, XSingleton<XAttributeMgr>.singleton.XPlayerData.MilitaryRank);
                }
                else
                {
                    if (this._entity.IsRole)
                    {
                        XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
                        this.DealWithTitleNameChange(this._entity.Attributes.TitleID, xroleAttributes.MilitaryRank);
                    }
                }
                this.DrawStr(this._nameSpcSymbol);
                this.KeepAllDepth();
                result = true;
            }
            return result;
        }

        // Token: 0x0600D15C RID: 53596 RVA: 0x003089A1 File Offset: 0x00306BA1
        public void OnGuildCollectNpcNameChange(string name)
        {
            XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
            {
                this.GetStr("", this._nameColor + name, false)
            });
            this.DrawStr(this._nameSpcSymbol);
        }

        // Token: 0x0600D15D RID: 53597 RVA: 0x003089E0 File Offset: 0x00306BE0
        private void SetupInfo(bool nameState, bool guildState, bool bloodBarState, bool indureBarState, string nameColor, Color guildColor, Color bloodColor, Color indureColor)
        {
            if (bloodBarState)
            {
                this._bloodBar.gameObject.SetActive(true);
                this._bloodBar.SetForegroundColor(bloodColor);
            }
            else
            {
                this._bloodBar.gameObject.SetActive(false);
            }
            if (nameState)
            {
                this._nameSpcSymbol.SetVisible(true);
                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                {
                    this.GetStr("", nameColor + this._entity.Attributes.Name, false)
                });
                this._nameColor = nameColor;
            }
            else
            {
                this._nameSpcSymbol.SetVisible(false);
            }
            if (guildState)
            {
                this._guildSpcSymbol.SetVisible(true);
                this._guildSpcSymbol.SetColor(guildColor);
            }
            else
            {
                this._guildSpcSymbol.SetVisible(false);
            }
            if (indureBarState)
            {
                this._indureBar.gameObject.SetActive(true);
                this._indureBar.SetForegroundColor(indureColor);
            }
            else
            {
                this._indureBar.gameObject.SetActive(false);
            }
        }

        // Token: 0x0600D15E RID: 53598 RVA: 0x00308AF8 File Offset: 0x00306CF8
        private void SetupGuildInfo()
        {
            if (XSingleton<XSceneMgr>.singleton.IsPVEScene() || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BATTLEFIELD_FIGHT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT)
            {
                this._guildSpcSymbol.SetVisible(false);
            }
            else
            {
                if (this._entity.IsPlayer)
                {
                    //zcg 
//                     XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
//                     bool bInGuild = specificDocument.bInGuild;
//                     if (bInGuild)
//                     {
//                         this._guildSpcSymbol.SetVisible(true);
//                         XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
//                         {
//                             this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XGuildDocument.GetPortraitName(specificDocument.BasicData.portraitIndex), false),
//                             this.GetStr("", string.Format("<{0}>", specificDocument.BasicData.guildName), false)
//                         });
//                         this.DrawStr(this._guildSpcSymbol);
//                     }
//                     else
                    {
                        this._guildSpcSymbol.SetVisible(false);
                    }
                }
                else
                {
                    if (this._entity.IsRole)
                    {
                        XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes;
                        if (xroleAttributes != null)
                        {
                            if (string.IsNullOrEmpty(xroleAttributes.GuildName))
                            {
                                this._guildSpcSymbol.SetVisible(false);
                            }
                            else
                            {
                                this._guildSpcSymbol.SetVisible(true);
                                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                                {
                                    //zcg this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XGuildDocument.GetPortraitName((int)xroleAttributes.GuildPortrait), false),
                                    this.GetStr("", string.Format("<{0}>", xroleAttributes.GuildName), false)
                                });
                                this.DrawStr(this._guildSpcSymbol);
                            }
                        }
                    }
                    else
                    {
                        if (this._entity.IsBoss)
                        {
                            this._guildSpcSymbol.SetVisible(false);
                        }
                    }
                }
            }
        }

        // Token: 0x0600D15F RID: 53599 RVA: 0x00308CDC File Offset: 0x00306EDC
        public override void OnDetachFromHost()
        {
            if (this._timer > 0U)
            {
                XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
            }
            if (this._hideTimer > 0U)
            {
                XSingleton<XTimerMgr>.singleton.KillTimer(this._hideTimer);
            }
            this._alwaysHide = 0;
            this._alwaysShow = false;
            this.DestroyGameObjects();
            this._entity.BillBoard = null;
            base.OnDetachFromHost();
        }

        // Token: 0x0600D160 RID: 53600 RVA: 0x00308D50 File Offset: 0x00306F50
        private void DestroyGameObjects()
        {
            if (this._billboard != null)
            {
                this.ClearRef(this._desiSpcSymbol);
                this.ClearRef(this._guildSpcSymbol);
                this.ClearRef(this._nameSpcSymbol);
                XBillBoardDocument.ReturnBillboard(this._billboard.gameObject);
                this._billboard = null;
            }
        }

        // Token: 0x0600D161 RID: 53601 RVA: 0x00308DB0 File Offset: 0x00306FB0
        private void ClearRef(IXUISpecLabelSymbol symbol)
        {
            if (symbol != null)
            {
                for (int i = 0; i < symbol.SpriteList.Length; i++)
                {
                    symbol.SpriteList[i].spriteName = "";
                    symbol.SetSpriteVisibleFalse(i);
                }
            }
        }

        // Token: 0x0600D162 RID: 53602 RVA: 0x00308DFC File Offset: 0x00306FFC
        private bool OnHideSelf(XEventArgs e)
        {
            this._alwaysHide |= 1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(BillBoardHideType.LevelScript);
            XBillboardHideEventArgs xbillboardHideEventArgs = e as XBillboardHideEventArgs;
            if (this._hideTimer > 0U)
            {
                XSingleton<XTimerMgr>.singleton.KillTimer(this._hideTimer);
            }
            this._hideTimer = XSingleton<XTimerMgr>.singleton.SetTimer(xbillboardHideEventArgs.hidetime, new XTimerMgr.ElapsedEventHandler(this.ReShow), null);
            return true;
        }

        // Token: 0x0600D163 RID: 53603 RVA: 0x00308E6F File Offset: 0x0030706F
        private void ReShow(object o)
        {
            this._alwaysHide &= ~(1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(BillBoardHideType.LevelScript));
        }

        // Token: 0x0600D164 RID: 53604 RVA: 0x00308E8C File Offset: 0x0030708C
        private bool OnShowCtrl(XEventArgs e)
        {
            XBillboardShowCtrlEventArgs xbillboardShowCtrlEventArgs = e as XBillboardShowCtrlEventArgs;
            bool result;
            if (xbillboardShowCtrlEventArgs.type == BillBoardHideType.Invalid)
            {
                XSingleton<XDebug>.singleton.AddErrorLog("undefine billboard hide type. check code or contect pyc.", null, null, null, null, null);
                result = false;
            }
            else
            {
                if (xbillboardShowCtrlEventArgs.show)
                {
                    this._alwaysHide &= ~(1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(xbillboardShowCtrlEventArgs.type));
                }
                else
                {
                    this._alwaysHide |= 1 << XFastEnumIntEqualityComparer<BillBoardHideType>.ToInt(xbillboardShowCtrlEventArgs.type);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x0600D165 RID: 53605 RVA: 0x00308F18 File Offset: 0x00307118
        public override void PostUpdate(float fDeltaT)
        {
            XEntity xentity = this._host as XEntity;
            if (xentity != null)
            {
                if (!this._entity.IsDummy && !this._active && this._billboard != null)
                {
                    if (!this._billboard.gameObject.activeInHierarchy)
                    {
                        return;
                    }
                    this.Attached();
                }
                if (!this.InitByMaster && this._entity.MobbedBy != null)
                {
                    this.InitByMaster = true;
                    XOthersAttributes xothersAttributes = this._entity.Attributes as XOthersAttributes;
                    if (xothersAttributes.SameBillBoardByMaster)
                    {
                        this.SetBillBoardSameByMaster();
                    }
                }
                if (!this.InitByMaster && this._entity.Attributes != null && this._entity.Attributes.HostID > 0UL)
                {
                    this.InitByMaster = true;
                    this.Refresh();
                }
                if (this._entity.IsDummy)
                {
                    this.UpdateDummyBillboard();
                }
                else
                {
                    if (!XEntity.ValideEntity(xentity))
                    {
                        this._uiDummy.alpha = 0f;
                    }
                    else
                    {
                        if (this._alwaysHide != 0)
                        {
                            this._uiDummy.alpha = 0f;
                        }
                        else
                        {
                            XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
                            if (player == null || player.EngineObject == null)
                            {
                                this.DestroyGameObjects();
                            }
                            else
                            {
                                float num = Vector3.Distance(xentity.EngineObject.Position, player.EngineObject.Position);
                                if (num > this._viewDistance && !this._bHitFlag)
                                {
                                    if (this._billboard != null)
                                    {
                                        if (!this._alwaysShow)
                                        {
                                            this._uiDummy.alpha = 0f;
                                            return;
                                        }
                                    }
                                }
                                if (this._billboard != null)
                                {
                                    this.UpdateHpBar();
                                }
                            }
                        }
                    }
                }
            }
        }

        // Token: 0x0600D166 RID: 53606 RVA: 0x00309140 File Offset: 0x00307340
        private void UpdateHpBar()
        {
            if (!this._inited && XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.WatchTo != null)
            {
                this.Attached();
            }
            if (this._uiDummy.alpha == 0f)
            {
                this._uiDummy.alpha = 1f;
            }
            float num = 0.2f;
            if (!this._bloodBar.gameObject.activeSelf)
            {
                num -= 0.05f;
            }
            if (!this._indureBar.gameObject.activeSelf)
            {
                num -= 0.05f;
            }
            this._heroHeight = ((this._entity.Transformer == null || !XEntity.ValideEntity(this._entity.Transformer)) ? this._entity.Height : this._entity.Transformer.Height);
            float num2;
            if (this._entity.Attributes != null && this._entity.Attributes.Outlook != null && this._entity.Attributes.Outlook.state != null && this._entity.Attributes.Outlook.state.bMounted)
            {
                num2 = this._heroRidingHeight;
            }
            else
            {
                num2 = this._heroHeight;
            }
            Vector3 position = new Vector3(this._entity.EngineObject.Position.x, this._entity.EngineObject.Position.y + num2 + num, this._entity.EngineObject.Position.z);
            if (this._entity.Prefab == "Empty_monster")
            {
                if (this._entity.Skill.IsCasting() && this._entity.Skill.CurrentSkill.Target != null)
                {
                    position = new Vector3(this._entity.Skill.CurrentSkill.Target.MoveObj.Position.x, this._entity.Skill.CurrentSkill.Target.MoveObj.Position.y + this._heroHeight + num, this._entity.Skill.CurrentSkill.Target.EngineObject.Position.z);
                }
            }
            this._billboard.position = position;
            this._billboard.rotation = XSingleton<XScene>.singleton.GameCamera.Rotaton;
            if (XSingleton<XEntityMgr>.singleton.Player != null)
            {
                float num3 = XBillboardComponent.k;
                float num4 = 6.27f;
                float num5 = Vector3.Distance(XSingleton<XScene>.singleton.GameCamera.UnityCamera.transform.position, this._billboard.position);
                if (!this._entity.IsPlayer)
                {
                    if (Time.frameCount % 15 == 0)
                    {
                        this.SetBillBoardDepth(false, num5);
                    }
                }
                num3 = num3 * this.f * num5 / num4;
                this._billboard.localScale = new Vector3(num3, num3, num3);
            }
            this._bloodBar.gameObject.SetActive(this._bHpbarVisible && !this._entity.Present.IsShowUp);
            this._indureBar.gameObject.SetActive(this._bIndurebarVisible && !this._entity.Present.IsShowUp);
            if (this._entity.Attributes != null)
            {
                if (this._onFreezeBuff)
                {
                    if (this._freezeBuffInfo != null)
                    {
                        this._bloodBar.gameObject.SetActive(true);
                        this._indureBar.gameObject.SetActive(false);
                        this._bloodBar.value = (float)(this._freezeBuffInfo.HP / this._freezeBuffInfo.maxHP);
                        Vector3 localScale = this._billboard.localScale;
                        this._billboard.localScale = localScale * 1.4f;
                        return;
                    }
                    this._onFreezeBuff = false;
                }
                double attr = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total);
                double num6 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic);
                if (num6 < 0.0)
                {
                    num6 = 0.0;
                }
                this._bloodBar.value = (float)(num6 / attr);
                if (this._indureBar.gameObject.activeInHierarchy)
                {
                    if (this._secondbar_usage == BillboardUsage.Indure)
                    {
                        double attr2 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxSuperArmor_Total);
                        double attr3 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentSuperArmor_Total);
                        if (attr2 > 0.0)
                        {
                            this._indureBar.gameObject.SetActive(true);
                            if (attr3 < attr2)
                            {
                                this._indureBar.value = (float)(attr3 / attr2);
                            }
                            else
                            {
                                this._indureBar.value = 1f;
                            }
                        }
                        else
                        {
                            this._indureBar.gameObject.SetActive(false);
                        }
                    }
                    else
                    {
                        if (this._secondbar_usage == BillboardUsage.MP)
                        {
                            double attr4 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxMP_Total);
                            double attr5 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentMP_Basic);
                            if (attr5 < attr4)
                            {
                                this._indureBar.value = (float)(attr5 / attr4);
                            }
                            else
                            {
                                this._indureBar.value = 1f;
                            }
                        }
                    }
                }
            }
        }

        // Token: 0x0600D167 RID: 53607 RVA: 0x00309738 File Offset: 0x00307938
        public void SetFreezeBuffState(UIBuffInfo buff)
        {
            if (buff == null)
            {
                this._onFreezeBuff = false;
                this._freezeBuffInfo = null;
                if (XEntity.ValideEntity(this._entity))
                {
                    this.Attached();
                }
            }
            else
            {
                this._onFreezeBuff = true;
                this._freezeBuffInfo = buff;
                this._nameSpcSymbol.SetVisible(true);
                BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)buff.buffID, (int)buff.buffLevel);
                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                {
                    this.GetStr("", XBillboardComponent.billboardString_red + buffData.BuffName, false)
                });
                this.DrawStr(this._nameSpcSymbol);
                this._bloodBar.SetForegroundColor(XBillboardComponent.billboard_red);
            }
        }

        // Token: 0x0600D168 RID: 53608 RVA: 0x003097FB File Offset: 0x003079FB
        public void HideBillboard()
        {
            this._uiDummy.alpha = 0f;
        }

        // Token: 0x0600D169 RID: 53609 RVA: 0x00309810 File Offset: 0x00307A10
        public void AttachDummyBillboard(string name, int level, int prof)
        {
            if (XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.SelectChar)
            {
                this._heroHeight = XSingleton<XProfessionSkillMgr>.singleton.GetSelectCharDummyHeight((uint)prof);
            }
            else
            {
                this._heroHeight = 1f;
            }
            float num = 0.003f;
            this._billboard.localScale = new Vector3(num, num, num);
            this._uiDummy.alpha = 1f;
            this._compRef = (this._billboard.GetComponent("XUIBillBoardCompRef") as IXUIBillBoardCompRef);
            this._bloodBar = this._compRef.BloodBar;
            this._indureBar = this._compRef.IndureBar;
            this._guildSpcSymbol = this._compRef.GuildSpecLabelSymbol;
            this._desiSpcSymbol = this._compRef.DesiSpecLabelSymbol;
            this._nameSpcSymbol = this._compRef.NameSpecLabelSymbol;
            this._bloodBar.SetVisible(false);
            this._indureBar.SetVisible(false);
            this._guildSpcSymbol.SetVisible(false);
            this._desiSpcSymbol.SetVisible(false);
            this._nameSpcSymbol.SetVisible(true);
            XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
            {
                this.GetStr("", string.Concat(new object[]
                {
                    "Lv.",
                    level,
                    " ",
                    name
                }), false)
            });
            this.DrawStr(this._nameSpcSymbol);
        }

        // Token: 0x0600D16A RID: 53610 RVA: 0x00309984 File Offset: 0x00307B84
        public float GetExitTitleHeight()
        {
            float num = 0f;
            if (this._billboard != null)
            {
                for (int i = 0; i < this._billboard.childCount; i++)
                {
                    Transform child = this._billboard.GetChild(i);
                    if (child.gameObject.activeSelf)
                    {
                        num = Mathf.Max(num, child.localPosition.y);
                    }
                }
            }
            return num;
        }

        // Token: 0x0600D16B RID: 53611 RVA: 0x00309A00 File Offset: 0x00307C00
        public bool AttachChild(Transform child, bool updatePos = false, float childHeight = 60f)
        {
            bool result;
            if (this._billboard != null)
            {
                child.parent = this._billboard;
                child.transform.localRotation = Quaternion.identity;
                child.transform.localScale = Vector3.one;
                if (updatePos)
                {
                    float exitTitleHeight = this.GetExitTitleHeight();
                    child.transform.localPosition = new Vector3(0f, exitTitleHeight + childHeight, 0f);
                }
                else
                {
                    child.transform.localPosition = Vector3.zero;
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return result;
        }

        // Token: 0x0600D16C RID: 53612 RVA: 0x00309A98 File Offset: 0x00307C98
        public bool UnAttachChild(Transform child)
        {
            if (this._billboard != null)
            {
                for (int i = 0; i < this._billboard.childCount; i++)
                {
                    Transform child2 = this._billboard.GetChild(i);
                    if (child2 == child)
                    {
                        child.parent = null;
                        return true;
                    }
                }
            }
            return false;
        }

        // Token: 0x0600D16D RID: 53613 RVA: 0x00309B04 File Offset: 0x00307D04
        private void UpdateDummyBillboard()
        {
            Vector3 vector = new Vector3(this._entity.EngineObject.Position.x, this._entity.EngineObject.Position.y + this._heroHeight, this._entity.EngineObject.Position.z);
            Vector3 vector2 = XSingleton<XCommon>.singleton.Horizontal(XSingleton<XScene>.singleton.GameCamera.CameraTrans.position - this._entity.EngineObject.Position);
            this._billboard.position = vector + vector2 * 0.5f;
            this._billboard.rotation = XSingleton<XScene>.singleton.GameCamera.Rotaton;
        }

        // Token: 0x0600D16E RID: 53614 RVA: 0x00309BCB File Offset: 0x00307DCB
        public void SetSelectCharStageScale()
        {
            this._billboard.localScale = this._billboard.localScale / 3f * 2f;
        }

        // Token: 0x0600D16F RID: 53615 RVA: 0x00309BFC File Offset: 0x00307DFC
        private void KeepAllDepth()
        {
            this.TextDepthMgr.Clear();
            this.SpriteDepthMgr.Clear();
            this.BoardDepthMgr.Clear();
            this.KeepDepth(this._desiSpcSymbol);
            this.KeepDepth(this._guildSpcSymbol);
            this.KeepDepth(this._nameSpcSymbol);
            if (this._entity.IsPlayer)
            {
                this.SetBillBoardDepth(true, 0f);
            }
        }

        // Token: 0x0600D170 RID: 53616 RVA: 0x00309C74 File Offset: 0x00307E74
        private void KeepDepth(IXUISpecLabelSymbol symbol)
        {
            if (symbol.IsVisible())
            {
                if (symbol.Label.IsVisible())
                {
                    this.TextDepthMgr.Add(symbol.Label);
                }
                if (symbol.Board.IsVisible())
                {
                    this.BoardDepthMgr.Add(symbol.Board);
                }
                for (int i = 0; i < symbol.SpriteList.Length; i++)
                {
                    if (symbol.SpriteList[i].IsVisible())
                    {
                        this.SpriteDepthMgr.Add(symbol.SpriteList[i]);
                    }
                }
            }
        }

        // Token: 0x0600D171 RID: 53617 RVA: 0x00309D18 File Offset: 0x00307F18
        private void SetBillBoardDepth(bool isMy, float dis = 0f)
        {
            if (this._billboard.gameObject.activeInHierarchy)
            {
                int num = isMy ? 10 : (-(int)(dis * 100f));
                for (int i = 0; i < this.TextDepthMgr.Count; i++)
                {
                    this.TextDepthMgr[i].spriteDepth = num;
                }
                for (int j = 0; j < this.SpriteDepthMgr.Count; j++)
                {
                    if (this.SpriteDepthMgr[j].spriteName != null)
                    {
                        this.SpriteDepthMgr[j].spriteDepth = num;
                    }
                }
                for (int k = 0; k < this.BoardDepthMgr.Count; k++)
                {
                    if (this.BoardDepthMgr[k].spriteName != null)
                    {
                        this.BoardDepthMgr[k].spriteDepth = num - 1;
                    }
                }
            }
        }

        // Token: 0x0600D172 RID: 53618 RVA: 0x00309E24 File Offset: 0x00308024
        private void DrawStr(IXUISpecLabelSymbol symbol)
        {
            symbol.SetInputText(XSingleton<UiUtility>.singleton.ComSpriteStr);
        }

        // Token: 0x0600D173 RID: 53619 RVA: 0x00309E38 File Offset: 0x00308038
        private string GetStr(string atlas, string sprite, bool isAnimation = false)
        {
            string result;
            if (isAnimation)
            {
                result = string.Format("{0}|{1}|1", atlas, sprite);
            }
            else
            {
                result = string.Format("{0}|{1}|0", atlas, sprite);
            }
            return result;
        }

        // Token: 0x0600D174 RID: 53620 RVA: 0x00309E6C File Offset: 0x0030806C
        private bool OnBigMeleePointChange(XEventArgs e)
        {
            //zcg XBigMeleeBattleDocument.RoleData roleData = XBigMeleeBattleDocument.Doc.userIdToRole[this._entity.ID];
            //zcg this.SetBigMeleePointInfo(roleData.point, DlgBase<BattleContiDlg, BattleContiBehaviour>.singleton.CurEnemy == this._entity.ID);
            return true;
        }

        // Token: 0x0600D175 RID: 53621 RVA: 0x00309EC0 File Offset: 0x003080C0
        private bool OnBigMeleeEnemyChange(XEventArgs e)
        {
            XBigMeleeEnemyChange xbigMeleeEnemyChange = e as XBigMeleeEnemyChange;
            //zcg  XBigMeleeBattleDocument.RoleData roleData = XBigMeleeBattleDocument.Doc.userIdToRole[this._entity.ID];
            //zcg  this.SetBigMeleePointInfo(roleData.point, xbigMeleeEnemyChange.isEnemy);
            return true;
        }

        // Token: 0x0600D176 RID: 53622 RVA: 0x00309F08 File Offset: 0x00308108
        private void SetBigMeleePointInfo(uint point, bool isEnemy)
        {
            if (this.pointType == 1)
            {
                int num = 1;
                int num2 = 1;
                int i;
                for (i = (int)point; i >= 10; i /= 10)
                {
                    num++;
                    num2 *= 10;
                }
                i = (int)point;
                int num3 = 0;
                string[] array;
                if (isEnemy)
                {
                    array = new string[num + 2];
                    array[num3++] = this.GetStr(XBillboardComponent.POINT_ATLAS, "icon_cr", false);
                }
                else
                {
                    array = new string[num + 1];
                }
                array[num3++] = this.GetStr(XBillboardComponent.POINT_ATLAS, "NmFight_jf", false);
                for (int j = num3; j < num3 + num; j++)
                {
                    array[j] = this.GetStr(XBillboardComponent.POINT_ATLAS, string.Format("NmFight_{0}", i / num2), false);
                    i %= num2;
                    num2 /= 10;
                }
                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(array);
            }
            else if (isEnemy)
            {
                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                {
                    this.GetStr(XBillboardComponent.POINT_ATLAS, "icon_cr", false),
                    this.GetStr("", string.Format("{0}:{1}", XStringDefineProxy.GetString("POINT"), point), false)
                });
            }
            else
            {
                XSingleton<UiUtility>.singleton.BillBoardCommonSetSpriteStr(new string[]
                {
                    this.GetStr("", string.Format("{0}:{1}", XStringDefineProxy.GetString("POINT"), point), false)
                });
            }
            this._guildSpcSymbol.SetVisible(true);
            this.DrawStr(this._guildSpcSymbol);
            XSingleton<UiUtility>.singleton.ComSpriteStr.Clear();
        }

        // Token: 0x04005EC0 RID: 24256
        public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("Character_Billboard");

        // Token: 0x04005EC1 RID: 24257
        public static string HPBAR_TEMPLATE = "UI/Billboard/Billboard";

        // Token: 0x04005EC2 RID: 24258
        private static readonly string BOSS_ICON_ATLAS = "common/Billboard";

        // Token: 0x04005EC3 RID: 24259
        private static readonly string BOSS_ICON_SPRITE = "BOSSicon";

        // Token: 0x04005EC4 RID: 24260
        private static readonly string ELITE_ICON_ATLAS = "common/Billboard";

        // Token: 0x04005EC5 RID: 24261
        private static readonly string ELITE_ICON_SPRITE = "BOSSicon";

        // Token: 0x04005EC6 RID: 24262
        private static readonly string GUILD_ICON_ATLAS = "common/Billboard";

        // Token: 0x04005EC7 RID: 24263
        private static readonly string DESIGNATION_ATLAS = "common/Title";

        // Token: 0x04005EC8 RID: 24264
        private static readonly string MILITARY_ATLAS = "common/Billboard";

        // Token: 0x04005EC9 RID: 24265
        private static readonly string NPCFAVOR_ICON_SPRITE = "Blessing";

        // Token: 0x04005ECA RID: 24266
        private static readonly string POINT_ATLAS = "common/Billboard";

        // Token: 0x04005ECB RID: 24267
        private Transform _billboard = null;

        // Token: 0x04005ECC RID: 24268
        private float _heroHeight = 10f;

        // Token: 0x04005ECD RID: 24269
        private float f = 1f;

        // Token: 0x04005ECE RID: 24270
        private IUIDummy _uiDummy = null;

        // Token: 0x04005ECF RID: 24271
        private static float k = 0.001f;

        // Token: 0x04005ED0 RID: 24272
        private static float[] fscale;

        // Token: 0x04005ED1 RID: 24273
        private float _heroRidingHeight = 0.5f;

        // Token: 0x04005ED2 RID: 24274
        private IXUIProgress _bloodBar = null;

        // Token: 0x04005ED3 RID: 24275
        private IXUIProgress _indureBar;

        // Token: 0x04005ED4 RID: 24276
        public IXUIBillBoardCompRef _compRef;

        // Token: 0x04005ED5 RID: 24277
        public IXUISpecLabelSymbol _desiSpcSymbol;

        // Token: 0x04005ED6 RID: 24278
        public IXUISpecLabelSymbol _guildSpcSymbol;

        // Token: 0x04005ED7 RID: 24279
        public IXUISpecLabelSymbol _nameSpcSymbol;

        // Token: 0x04005ED8 RID: 24280
        private bool InitByMaster = false;

        // Token: 0x04005ED9 RID: 24281
        private string _nameColor = "";

        // Token: 0x04005EDA RID: 24282
        private float _viewDistance = 0f;

        // Token: 0x04005EDB RID: 24283
        private bool _alwaysShow = false;

        // Token: 0x04005EDC RID: 24284
        private int _alwaysHide = 0;

        // Token: 0x04005EDD RID: 24285
        private BillboardUsage _secondbar_usage = BillboardUsage.Indure;

        // Token: 0x04005EDE RID: 24286
        private bool _bHitFlag = false;

        // Token: 0x04005EDF RID: 24287
        private uint _timer = 0U;

        // Token: 0x04005EE0 RID: 24288
        private uint _hideTimer = 0U;

        // Token: 0x04005EE1 RID: 24289
        private bool _onFreezeBuff = false;

        // Token: 0x04005EE2 RID: 24290
        private UIBuffInfo _freezeBuffInfo;

        // Token: 0x04005EE3 RID: 24291
        public static readonly Color billboard_red = new Color32(byte.MaxValue, 61, 35, byte.MaxValue);

        // Token: 0x04005EE4 RID: 24292
        public static readonly Color billboard_yellow = new Color32(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue);

        // Token: 0x04005EE5 RID: 24293
        public static readonly Color billboard_gold = new Color32(byte.MaxValue, 153, 0, byte.MaxValue);

        // Token: 0x04005EE6 RID: 24294
        public static readonly Color billboard_sgreen = new Color32(123, byte.MaxValue, 128, byte.MaxValue);

        // Token: 0x04005EE7 RID: 24295
        public static readonly Color billboard_green = new Color32(92, byte.MaxValue, 0, byte.MaxValue);

        // Token: 0x04005EE8 RID: 24296
        public static readonly Color billboard_blue = new Color32(0, 189, byte.MaxValue, byte.MaxValue);

        // Token: 0x04005EE9 RID: 24297
        public static readonly Color billboard_white = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);

        // Token: 0x04005EEA RID: 24298
        public static readonly Color billboard_ally_hp = new Color32(byte.MaxValue, 236, 0, byte.MaxValue);

        // Token: 0x04005EEB RID: 24299
        public static readonly Color billboard_favor = new Color32(byte.MaxValue, 145, 69, byte.MaxValue);

        // Token: 0x04005EEC RID: 24300
        public static readonly Color nullColor = new Color32(0, 0, 0, 0);

        // Token: 0x04005EED RID: 24301
        public static readonly string billboardString_red = "[ff3d23]";

        // Token: 0x04005EEE RID: 24302
        public static readonly string billboardString_syellow = "[ffeb04]";

        // Token: 0x04005EEF RID: 24303
        public static readonly string billboardString_blue = "[00bdff]";

        // Token: 0x04005EF0 RID: 24304
        public static readonly string billboardString_gold = "[ff9900]";

        // Token: 0x04005EF1 RID: 24305
        public static readonly string billboardString_white = "[ffffff]";

        // Token: 0x04005EF2 RID: 24306
        public bool _bHpbarVisible = false;

        // Token: 0x04005EF3 RID: 24307
        public bool _bIndurebarVisible = false;

        // Token: 0x04005EF4 RID: 24308
        private XTimerMgr.ElapsedEventHandler _resetOnHitCb = null;

        // Token: 0x04005EF5 RID: 24309
        private bool _inited = false;

        // Token: 0x04005EF6 RID: 24310
        private bool _active = false;

        // Token: 0x04005EF7 RID: 24311
        private List<IXUILabel> TextDepthMgr = new List<IXUILabel>();

        // Token: 0x04005EF8 RID: 24312
        private List<IXUISprite> SpriteDepthMgr = new List<IXUISprite>();

        // Token: 0x04005EF9 RID: 24313
        private List<IXUISprite> BoardDepthMgr = new List<IXUISprite>();

        // Token: 0x04005EFA RID: 24314
        private int pointType = int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("BigMeleePointType"));
    }
}
